fix(frontend): keep workspace settings on the workspace in the URL - #174
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
MainApp renders a single WorkspaceSettings instance for every /workspaces/:id/settings/* view, so moving between two workspaces' settings changes the workspaceId prop under a mounted component. The component loaded its workspace only in onMount, so after such a switch the page kept rendering the previously opened workspace: its name, key, description and — on the danger tab — its "Active Workspace" toggle and delete confirmation, while saveWorkspace() and deleteWorkspace() already addressed the new id from the URL. Saving wrote one workspace's settings onto another, and the delete confirmation was validated against the old workspace's name while deleting the new one. Load from the workspaceId prop instead of from the mount, with a load version guard so a superseded response cannot repopulate the form, and clear workspace/form/delete-confirmation state on every switch. A workspace that cannot be loaded now falls through to the existing "Workspace not found" branch instead of showing another workspace. Fence the save and delete completions the same way: both pin their target id (and the payload / the confirmed name) before awaiting. What the server actually changed is applied unconditionally — the workspace list must drop a deleted workspace and pick up a renamed one wherever the user has moved to — while the view-scoped effects (form state, currentWorkspace, the toast, the redirect off the deleted workspace) only run while that target is still the one on screen. For the same reason, MainApp no longer leaves the previously hydrated workspace in currentWorkspace when the routed one fails to load: the shell (workspace header, avatar, gradient, command-palette scope) must not present a different workspace than the URL names.
0398176 to
c7096be
Compare
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
|
Heads-up for maintainers: the failing |
|
Thank you for the contribution @fmaass - I will have a look at this PR + the cla issue |
|
recheck |
|
ok now I signed the cla but it does not matter :) |
Problem
Opening one workspace's settings and then navigating to another workspace's settings leaves the page showing the first workspace.
MainApprenders a singleWorkspaceSettingsinstance for every/workspaces/:id/settings/*view, but the component loaded its workspace only inonMount. After such a switch the form still holds the previous workspace's name, key, description and — on the Danger tab — its "Active Workspace" toggle and delete confirmation, whilesaveWorkspace()anddeleteWorkspace()already address the new id from the URL: saving writes one workspace's settings onto another, and the delete confirmation is validated against the old workspace's name while deleting the new one.Fix
workspaceIdprop (the same$effect+ load-key patternWorkspaceWelcomeuses), with a load-version guard so a superseded response cannot repopulate the form.MainAppclears stalecurrentWorkspacecontext as soon as the route changes, then hydrates it from the routed workspace response.Verification
npm run check,npm run typecheck, andnpm run buildpass.